<template>
	<view class="ys-page">
		<!-- <view class="nav">
			<view :class="nid == item.id?'nitem on':'nitem'" v-for="(item,index) in navlist" :key="index"
				@click="changeNav(item)">
				<text>{{item.text}}</text>
			</view>
		</view>
		<view class="searchbox">
			<view class="search">
				<input type="text" placeholder="请输入房东姓名" v-model="searchText" @confirm="search" />
				<uni-icons type="search" @click="search" color="#777" size="20"></uni-icons>
			</view>
		</view> -->
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index" @click="toPage(`./ownerdetail?id=${item.id}`)">
				<view class="imgbox">
					<image :src="item.avatar || '/static/0.png'" mode="aspectFill"></image>
				</view>
				<view class="info">
					<view class="name">
						<view class="left">
							{{item.name}}
						</view>
						<view class="right">
							<image src="/static/img/man.png" v-if="item.gender == 0" mode="widthFix"></image>
							<image src="/static/img/man.png" v-else-if="item.gender ==1" mode="widthFix"></image>
						</view>
					</view>
					<view class="phone">
						{{item.mobile}}
					</view>
					<view class="phone">
						{{item.idNum}}
					</view>
				</view>
				<!-- <uni-icons type="right" color="#777"></uni-icons> -->
				<text class="status">{{statusType[item.auditStatus]}}</text>
			</view>
		</view>
		<view class="no-list" v-if="list.length == 0">
			- 暂无数据 -
		</view>
	</view>
</template>

<script>
	import {
		ownerRudit
	} from "@/api/system.js"
	export default {
		data() {
			return {
				page: 1,
				last_page: 1,
				list: [],
				pageSize: 15,
				navlist: [{
						text: '全部',
						id: ''
					},
					{
						text: '未审核',
						id: 1
					},
					{
						text: '其他',
						id: 2
					}
				],
				nid: '',
				statusType: {
					0: '未审核',
					1: '已审核',
					2: '已拒绝',
					3: '黑名单',
					4: '审核中'
				}
			}
		},
		onLoad() {},
		onShow() {
			this.clear()
		},
		methods: {
			changeNav(item) {
				this.nid = item.id
				this.clear()
			},
			search() {
				this.clear()
			},
			clear() {
				this.page = 1
				this.last_page = 1
				this.list = []
				this.ownerRudit()
			},
			ownerRudit() {
				ownerRudit({
					pageNum: this.page,
					pageSize: this.pageSize
				}).then(res => {
					if (res.code == 200) {
						this.list = this.list.concat(res.data.records)
						this.last_page = res.data.pages
					}
				})
			}

		}
	}
</script>

<style lang="scss">
	.nav {
		display: flex;
		align-items: center;
		height: 40px;
		font-size: 14px;
		top: 0;
		/* #ifdef H5 */
		top: 44px;
		/* #endif */
		position: sticky;
		background: #fff;

		.nitem {
			flex: 1;
			text-align: center;
		}

		.on {
			color: #ff9466;
			font-weight: bold;
			font-size: 16px;

			text {
				border-bottom: 2px solid;
				padding-bottom: 5px;
			}
		}
	}

	.searchbox {
		position: sticky;
		top: 40;
		/* #ifdef H5 */
		top: 84px;
		/* #endif */
		background: #fff;
		padding: 5px 10px;
		margin-bottom: 10px;
		z-index: 1024;

		.search {
			background: #f2f2f2;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding-right: 8px;

			input {
				font-size: 14px;
				padding: 8px;
				flex: 1;
				padding-right: 10px;
			}
		}
	}

	.list {
		padding: 10px;

		.item {
			display: flex;
			align-items: center;
			background: #fff;
			margin-bottom: 10px;
			border-radius: 8px;
			padding: 5px;
			position: relative;

			.status {
				position: absolute;
				top: 15px;
				right: 10px;
				font-size: 12px;
			}

			image {
				width: 80px;
				height: 80px;
			}

			.info {
				width: calc(100% - 100px);
				padding-left: 10px;
				box-sizing: border-box;

				.name {
					font-weight: bold;
					display: flex;
					align-items: center;
					font-size: 15px;

					text {
						margin-left: 5px;
						font-weight: normal;
						font-size: 12px;
					}

					image {
						width: 20px;
						vertical-align: middle;
						margin-left: 10px;
					}
				}

				.phone {
					font-size: 13px;
					margin-top: 5px;
				}
			}

		}
	}
</style>